﻿using Storage.Mapping.AppStorage;
using Storage.Mapping.BucketCut;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace Storage.Mapping.Bucket
{
    [Serializable]
    public class BucketMapping
    {
        /// <summary>
        /// 
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public Guid AppStorageId { get; set; }

        /// <summary>
        /// 桶名称，不能重复存在
        /// </summary>
        [Required(ErrorMessage ="请输入名称")]
        [RegularExpression(@"^[A-Za-z][A-Za-z-_]*$",ErrorMessage = "格式只能是字母，'-','_'的组合,并且字母开头")]
        [Remote("existBucketName", AdditionalFields ="Id",ErrorMessage = "已被占用")]
        public string Name { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public DateTime CreationTime { get; set; }


        #region

        /// <summary>
        /// 
        /// </summary>
        public AppStorageMapping AppStorage { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public List<BucketCutMapping> BucketCutList { get; set; }

        #endregion

    }
}
